<template>
    <div class='wrap'>
        <swiper :options="swiperOptions" ref="mySwiper" v-if="showSwiper">
            <swiper-slide v-for='item of list' :key="item.id">
                <img :src='item.imgUrl' class='swiper-img'>
            </swiper-slide>
            <div class="swiper-pagination"  slot="pagination"></div>
        </swiper>
    </div>
</template>
<script>
export default {
    name:'HomeSwiper',
    props:{
       list:Array
    },
    computed:{
        showSwiper(){
           return this.list.length
        }
    },
    data() {
        return{
           swiperOptions:{
                pagination:'.swiper-pagination',
                loop:true,
                autoplay:3000
           }
        }
    }
}
</script>
<style lang="scss" scoped>
    .wrap{
        position:relative;
        width:100%;
        height:0;
        padding-bottom:31.3%;
        overflow:hidden;
        background-color:#eee;
    }
    .swiper-slide {
        width:100%;
    }
    .swiper-img{
       width:100%;
    }
    .wrap /deep/ .swiper-pagination-bullet-active{
        background-color:#fff!important;
    }
</style>

